#!/usr/bin/env python

import unicodedata

for i in range(32,256):
    c = chr(i)
    try:
        un = c.decode('cp1252')
    except UnicodeDecodeError:
        ut_car = ' '
        ut_cod = ' '
        un_cod = ' '*4
        d = '<undefined>'
        iso = '  '
    else:
        ut_car = un.encode('utf-8')
        ut_cod = ':'.join('%02x' % ord(byte) for byte in ut_car)
        un_cod = '%04x' % ord(un)
        try:
            d = unicodedata.name(un)
        except ValueError:
            d = '<no such name>'    
        iso = '==' if ord(un) == i else '!='
    ut_cod = '%-8s' % ut_cod    
    print '%3d  %02x  %s  %s  %s  %s  %s' % (i,i,iso,un_cod,ut_cod,ut_car,d)

